package com.meilai.project.mapper.business.building;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.meilai.project.entity.business.building.BuildingAreaTypeMediaTypeRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author ljy
 * @Date 2022/5/30 22:26
 */
@Mapper
public interface BuildingAreaTypeMediaTypeRelationMapper extends BaseMapper<BuildingAreaTypeMediaTypeRelation> {

    @Select("SELECT media_type_id from `building_area_type_media_type_relation` where building_area_type_id = #{building_area_type_id} order by id desc limit 1 ")
    Long getMediaTypeId(@Param("building_area_type_id") Long building_area_type_id);

    @Select("select DISTINCT building_area_type_id from `building_area_type_media_type_relation`")
    List<Long> getBuildingAreaTypeIds();

    @Select("select media_type_id from `building_area_type_media_type_relation` where building_area_type_id = #{building_area_type_id}")
    List<Long> getMediaTypeIdsByBuildingAreaTypeId(@Param("building_area_type_id") Long building_area_type_id);
}
